package com.hskn.hss.module.clock.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hskn.hss.core.utils.LoginUtils;
import com.hskn.hss.exception.HssException;
import com.hskn.hss.module.clock.entity.Clock;
import com.hskn.hss.module.clock.mapper.ClockMapper;
import com.hskn.hss.module.clock.service.IClockService;
import com.hskn.hss.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author hskn
 * @since 2021-05-17
 */
@Service
public class ClockServiceImpl extends ServiceImpl<ClockMapper, Clock> implements IClockService {

    @Resource
    private ClockMapper clockMapper;

    @Override
    @Transactional
    public void mUpdate(JSONObject params) throws HssException {

        String uid = LoginUtils.getUser().getUid();
        if (StringUtils.isEmpty(params) || StringUtils.isEmpty(params.getString("clockId"))) {
            throw new HssException("参数错误");
        }
        Clock clock = JSON.parseObject(params.toJSONString(), Clock.class);
        clock.setUpdateUid(uid);
//        clockMapper.updateById(clock);
    }

}
